package com.itheima.reggie.common;

import com.itheima.reggie.domain.Employee;

import javax.servlet.http.HttpSession;

public class EmployeeUtil {
	//获取当前用户信息
	// private HttpSession session;
	
	/***
	 * 通过session返回用户对象
	 * @param session 传入session对象
	 * @return 返回一个Employee对象
	 */
	public static Employee getNowUser(HttpSession session) {
		return (Employee)session.getAttribute("SESSION_EMPLOYEE");
	}
	
	/***
	 * 通过key从session中获取对象
	 * @param session session对象
	 * @param key 键值
	 * @return 返回Object对象
	 */
	public static Object getObjectFromSession(HttpSession session,String key) {
		return session.getAttribute(key);
	}
}
